package top.chmin.project.cloud.common.dict.data.auto;

// field import auto
// #bind.field.id#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-27 15:50:18
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class DictData extends Model {

    // field auto
// #bind.field.dictCode#
    // 字典编码
    private String dictCode;
// $bind.field.dictCode$

// #bind.field.dictValue#
// 字典Value
    private String dictValue;
// $bind.field.dictValue$

    // #bind.field.dictLabel#
    // 字典Label
    private String dictLabel;
// $bind.field.dictLabel$

    // #bind.field.dictOrder#
    // 排序
    private Integer dictOrder;
// $bind.field.dictOrder$


    @Override
    public DictDataEPC getPreCondition() {
        return new DictDataEPC();
    }

    public class DictDataEPC extends PreCondition {
        private DictDataEPC() {
        }

        private DictDataEPC(DictDataEPC parent) {
            super(parent);
        }

        public DictDataEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.dictCode#
            addUpdateSql("dict_code = ?", dictCode);
// $bind.field.dictCode$

// #bind.field.dictValue#
            addUpdateSql("dict_value = ?", dictValue);
// $bind.field.dictValue$

// #bind.field.dictLabel#
            addUpdateSql("dict_label = ?", dictLabel);
// $bind.field.dictLabel$

// #bind.field.dictOrder#
            addUpdateSql("dict_order = ?", dictOrder);
// $bind.field.dictOrder$

            type = "UPDATE";
            return this;
        }

        public DictDataEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public DictDataEPC forCount() {
            type = "COUNT";
            return this;
        }

        public DictDataEPC sub() {
            return new DictDataEPC(this);
        }

        public DictDataEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (DictDataEPC) parent;
        }

        public DictDataFPC toFlex() {
            DictDataFPC flex = new DictDataFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(DictData.class, "cm_dict_data");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.dictCode#
        public DictCode dictCode() {
            return new DictCode();
        }
// $bind.field.id$

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }

        // #bind.field.dictOrder#
        public DictOrder dictOrder() {
            return new DictOrder();
        }
// $bind.field.createBy$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        public class Id extends LongEPCField<DictDataEPC> {
            private Id() {
                super(DictDataEPC.this, "id", id);
            }
        }
// $bind.field.updateBy$

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }

        public class CreateBy extends StringEPCField<DictDataEPC> {
            private CreateBy() {
                super(DictDataEPC.this, "create_by", createBy);
            }
        }
// $bind.field.createTime$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        public class UpdateBy extends StringEPCField<DictDataEPC> {
            private UpdateBy() {
                super(DictDataEPC.this, "update_by", updateBy);
            }
        }
// $bind.field.updateTime$

        public class CreateTime extends LocalDateTimeEPCField<DictDataEPC> {
            private CreateTime() {
                super(DictDataEPC.this, "create_time", createTime);
            }
        }

        public class UpdateTime extends LocalDateTimeEPCField<DictDataEPC> {
            private UpdateTime() {
                super(DictDataEPC.this, "update_time", updateTime);
            }
        }
// $bind.field.dictCode$

        // #bind.field.dictValue#
        public DictValue dictValue() {
            return new DictValue();
        }

        public class DictCode extends StringEPCField<DictDataEPC> {
            private DictCode() {
                super(DictDataEPC.this, "dict_code", dictCode);
            }
        }
// $bind.field.dictValue$

        // #bind.field.dictLabel#
        public DictLabel dictLabel() {
            return new DictLabel();
        }

        public class DictLabel extends StringEPCField<DictDataEPC> {
            private DictLabel() {
                super(DictDataEPC.this, "dict_label", dictLabel);
            }
        }
// $bind.field.dictLabel$

        public class DictValue extends StringEPCField<DictDataEPC> {
            private DictValue() {
                super(DictDataEPC.this, "dict_value", dictValue);
            }
        }

        public class DictOrder extends IntegerEPCField<DictDataEPC> {
            private DictOrder() {
                super(DictDataEPC.this, "dict_order", dictOrder);
            }
        }
// $bind.field.dictOrder$

    }
}
